{$CLEO .cs}
thread 'ogf_1'



repeat
repeat

wait 0 
until if Player.Defined(0)
077E: get_active_interior_to 22@ 
until if 22@ == 0
Model.Load(#fam1)
Model.Load(#MAVERICK)
Model.Load(#AK47)     
Model.Load(#ROCKETLA)      
038B: load_requested_models 

while true
    wait 0                                           
    if and                                            
       Model.Available(#fam1)                                
       Model.Available(#MAVERICK)                             
       Model.Available(#AK47)                                  
       Model.Available(#ROCKETLA)                             
    then break                                       
    end                                              
end

WHILE TRUE
    wait 0                                                                                                  
    04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 50.0 50.0 50.0                   
    04C4: store_coords_to 6@ 7@ 8@ from_actor $PLAYER_ACTOR with_offset -50.0 -50.0 0.0                   
    0208: 9@ = random_float_in_ranges 1@ 6@                                                                 
    0208: 10@ = random_float_in_ranges 2@ 7@                                                                
    0087: 11@ = 3@ // (float)                                                                               
    if 00C2:   sphere_onscreen 9@ 10@ 11@ radius 5.0                                                        
    JF BREAK                                                                                                
END 
30@ = Car.Create(#MAVERICK, 9@, 10@, 11@)
Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
Car.SetImmunities(30@, 1, 1, 1, 1, 1)
Car.Health(30@) = 5000
039F: set_car 30@ race_to 1@ 2@
0825:  30@ instant_rotor_start 
0726: heli 30@ follow_actor $PLAYER_ACTOR follow_car -1 radius 25.0 
07BB: set_heli 30@ horizontal_thrust_power 6 
//--------------------------------------------
28@ = Actor.CreateAsDriver(Gang2, #fam1, 30@)
Actor.Health(28@) = 100000
Actor.SetImmunities(28@, 1, 1, 1, 1, 1)
Actor.SetMaxHealth(28@, 1000)
0446: set_actor 28@ dismemberment_possible 0
//--------------------------------------------
27@ = Actor.Create(Gang2, #fam1, 9@, 10@, 11@)
Actor.Health(27@) = 1000
Actor.SetImmunities(27@, 0, 1, 1, 1, 1)
0446: set_actor 27@ dismemberment_possible 0 
Actor.GiveWeaponAndAmmo(27@, 30, 9999)                                                        
07DD: set_actor 27@ attack_rate 100 // previously known as temper_to                          
Actor.WeaponAccuracy(27@) = 98
0464: put_actor 27@ into_turret_on_car 30@ at_car_offset 1.7 1.3 -0.1 position 3 shooting_angle_limit 360.0 with_weapon 30
26@ = Actor.Create(Gang2, #fam1, 9@, 10@, 11@)
Actor.Health(26@) = 1000
Actor.SetImmunities(26@, 0, 1, 1, 1, 1)
0446: set_actor 26@ dismemberment_possible 0 
Actor.GiveWeaponAndAmmo(26@, 35, 9999)                                            
07DD: set_actor 26@ attack_rate 100 // previously known as temper_to              
Actor.WeaponAccuracy(26@) = 98
0464: put_actor 26@ into_turret_on_car 30@ at_car_offset -1.7 1.3 -0.1 position 3 shooting_angle_limit 360.0 with_weapon 35
//--------------------------------------------------------------------------------------------

//--------
VAR
   29@:int
   27@:int
   26@:int
   28@:int
END

  


8@ = 0
7@ = 1
WHILE TRUE
    WAIT 0
    if not Car.Wrecked(30@)
    jf continue
    Actor.StorePos(27@, 17@, 18@,  19@)                                                                                   
    if 0AE1: 29@ = random_actor_near_point 17@ 18@ 19@ in_radius 100.0 find_next 1 pass_deads 0 //IF and SET              
    jf continue                                                                                                                  
    if not 29@ == -1                                                                                                   
    jf continue                                                                                                              
    if and                                                                                                        
       not actor.Dead(29@)                                                                                         
       not 29@ == 27@ //vehicle gunner
       not 29@ == 26@ //vehicle gunner                                                                              
       not 29@ == 28@  //vehicle driver                                                                             
    jf continue                                                                                                          
    089F: get_actor 29@ pedtype_to 23@                                                                          
    if or
       23@ == 6  //GANG1 (cops)                                                                                                                           
       23@ == 7  //GANG1 (Ballas)                                                                                              
       23@ == 9  //GANG3 (Los Santos Vagos)                                                                                    
       23@ == 10  //GANG4 (San Fierro Rifa)                                                                                    
       23@ == 11  //GANG5 (Da Nang Boys)                                                                                       
       23@ == 12  //GANG6 (Mafia)                                                                                              
       23@ == 13  //GANG7 (Mountain Cloud Triad)                                                                               
       23@ == 14  //GANG8 (Varrio Los Aztecas)                                                                                 
    jf continue
    if 056D:   actor 29@ defined 
    jf continue
    if not actor.Dead(29@) 
    jf continue  
    IF 0202:   actor 29@ near_car 30@ radius 60.0 60.0 sphere 0                                 
    THEN                                                                                                   
        04C4: store_coords_to 4@ 5@ 6@ from_actor 29@ with_offset 0.0 30.0 0.0                                    
        04A2: set_heli 30@ fly_to 4@ 5@ 6@ altitude_between 25.0 and 25.0                                                    
        IF  7@ == 2                                                                                                            
        THEN                                                                       
            if 20@ == 1
            then
                //______________________________________________________ak47 attack                                        
                0208: 25@ = random_float_in_ranges -2.4 2.4                                                                     
                0208: 24@ = random_float_in_ranges -2.4 2.4                                                          
                if 056D:   actor 29@ defined                                                                            
                then
                    if 056D:   actor 27@ defined        
                    then
                        if not actor.dead(27@)
                        then
                            if not Actor.HasWeapon(27@, 30)
                            then Actor.GiveWeaponAndAmmo(27@, 30, 9999)
                            end
                                04C4: store_coords_to 4@ 5@ 6@ from_actor 29@ with_offset 25@ 0.0 24@                           
                                0668: AS_actor 27@ rotate_and_shoot_at 4@ 5@ 6@ 2000 ms                                    
                            
                        end
                    end                                                                                                
                end                                                                                                    
                //--------------------------------------------------------------------                                 
                0208: 25@ = random_float_in_ranges -1.4 1.4                                                                     
                0208: 24@ = random_float_in_ranges -1.4 1.4                                                          
                if 056D:   actor 29@ defined                                                                            
                then
                    if 056D:   actor 26@ defined  
                    then
                        if not actor.dead(26@)
                        then
                            if not Actor.HasWeapon(26@, 30)
                            then Actor.GiveWeaponAndAmmo(26@, 30, 9999)
                            end
                                04C4: store_coords_to 4@ 5@ 6@ from_actor 29@ with_offset 25@ 0.0 24@                           
                                0668: AS_actor 26@ rotate_and_shoot_at 4@ 5@ 6@ 2000 ms                                    
                        end
                    end                                                                                                
                end                                                                                                    
                //_______________________________________________________________
            else 
                if 20@ == 2
                then
                    //______________________________________________________rpg attack                                      
                    0208: 25@ = random_float_in_ranges -5.4 5.4                                                                     
                    0208: 24@ = random_float_in_ranges -5.4 5.4                                                          
                    if 056D:   actor 29@ defined                                                                            
                    then 
                        if 056D:   actor 27@ defined        
                        then
                            if not actor.dead(27@)
                            then
                                if not Actor.HasWeapon(27@, 35)
                                then Actor.GiveWeaponAndAmmo(27@, 35, 9999)
                                end
                                    04C4: store_coords_to 4@ 5@ 6@ from_actor 29@ with_offset 25@ 0.0 24@                           
                                    0668: AS_actor 27@ rotate_and_shoot_at 4@ 5@ 6@ 2000 ms                                    
                                
                            enD
                        end                                                                                                
                    end                                                                                                    
                    //--------------------------------------------------------------------                                 
                    0208: 25@ = random_float_in_ranges -5.4 5.4                                                                     
                    0208: 24@ = random_float_in_ranges -5.4 5.4                                                          
                    if 056D:   actor 29@ defined                                                                            
                    then 
                        if 056D:   actor 26@ defined        
                        then
                            if not actor.dead(26@)
                            then
                                if not Actor.HasWeapon(26@, 35)
                                then Actor.GiveWeaponAndAmmo(26@, 35, 9999)
                                end
                                    04C4: store_coords_to 4@ 5@ 6@ from_actor 29@ with_offset 25@ 0.0 24@                           
                                    0668: AS_actor 26@ rotate_and_shoot_at 4@ 5@ 6@ 2000 ms                                    
                                
                            enD
                        end                                                                                                
                    end                                                                                                     
                    //_______________________________________________________________     
                end
            end                                      
        END                                                                                                        
    ELSE                                                                                                   
        04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 20.0 0.0                
        04A2: set_heli 30@ fly_to 1@ 2@ 3@ altitude_between 25.0 and 25.0
    end                                    
    IF 7@ == 1                                                
    THEN                                                      
        IF NOT 8@ >= 50                                      
        THEN 8@ += 1                                         
        ELSE 7@ = 2
            0209: 20@ = random_int_in_ranges 1 3                                           
        END                                                   
    END                                                       
    IF 7@ == 2                                                
    THEN                                                      
        IF 8@ > 0                                            
        THEN 8@ -= 1                                         
        END                                                   
    END                                                       
    IF 8@ == 1                                               
    THEN 7@ = 1                                               
    END                                                       
    0AF0: 2@ = get_int_from_ini_file "CLEO\POZIT.INI" section "ogf_1" key "get" 
    if OR 
        2@ == 1
        02BF:   car 30@ sunk 
        Car.Wrecked(30@)
        PLAYER.Wasted(0)
    THEN
        break
    end
    if and
        ACTOR.Dead(27@)
        ACTOR.Dead(26@)
    then
        break
    end
end    
    
Actor.RemoveReferences(27@)                
Actor.RemoveReferences(28@)                 
Actor.RemoveReferences(26@)                
Car.RemoveReferences(30@)                   
CAR.Destroy(30@)                               
end_thread